package com.lovo.cloud.service.impl;

import com.lovo.cloud.model.dos.Order2DO;
import com.lovo.cloud.dao.Order2DAO;
import com.lovo.cloud.model.dto.Order2DTO;
import com.lovo.cloud.service.Order2Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author luo
 * @since 2020-12-09
 */
@Service
public class Order2ServiceImpl extends ServiceImpl<Order2DAO, Order2DO> implements Order2Service {

    @Resource
    private Order2DAO order2DAO;

    @Override
    public boolean addOrder(Order2DTO order2DTO) {
        boolean bl = false;
        Order2DO order2DO = new Order2DO();
        String orderNum = System.currentTimeMillis()+"";
        order2DO.setOrderNum(orderNum);
        BeanUtils.copyProperties(order2DTO,order2DO);
        if (order2DAO.insert(order2DO) >0) {
            bl = true;
        }
        return bl;
    }
}
